home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / AGSTUT1.ZIP / AGSTUT1.DOC < prev    next >
Text File  |  1995-03-04  |  7KB  |  216 lines

  1.  
  2.        ▄▄▄▄▄▄                        ▄
  3.      ▄█▀▀██████▄                             ▄
  4.      █    ██████▀ ▄▄█████████████▀  ▄▄▄▄▄▄▄▄▄▄ ▀▄█ ▄     ▄▄▄▄▄▄▄▄▄
  5.      ░▀  ▐██▀██ ▄██▀▀▀      ▀█▀ ▄▄█████████████▄ ████▄ ▄███████████▄
  6.       ░  ██▌ ▐█ ██           ░ ██▀▀ ▄▄▄▄▄▄▄▄▄ ▀█ █ ▄ ▄ █▀        ▄ █
  7.          ██   █ ▀█            ██▀ █▀         ▀▄▄ ▄▄██▀ █▄         ▀▌ ▄
  8.         ▐█▌   ▐█ █ ▄▄▄▄█▄▄▄▄▄ ██ █             ▀▄ ▀██ ▀████████▄
  9.         ██     █ █▄ ▀░     ▀█ ██▄ █       ▄▀▀▄   █ ███ ░▀▀▀▀▀▀▀▀▓▓▄
  10.         ██  ▄  █ ▀█▄        ░  ██ ▀▄      ░  ▀▄  █ ███           ▀██
  11.        ▐█ ▄███▄ █ ▀█▄           ██▄ ▀▄▄▄▄▄  ▄▄▀ ██ ███  ▄        ▄██
  12.    ▄▄      █▄ ░    ▄██ ▀██▄▄ ▄  ▄▄█▄ ▀██▄▄▄▄▄ ▀▀ ▄▄███ ██ ▄█ ▀    ▄▄▓▓█  ▀
  13.   █  ▀   ▄██       ░▀▀█▄ ▀▀██████████▄ ██████████████ ▄██ ███████████▀ ░
  14.   ▌▀▄▄▄██▀▀ ░ kP<aRT>░▀███▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄ ▄  ▄   ▄
  15.   ▌
  16.                ▀            ▀   ▀ ▄ ▄▀ ▀▄█ █▀▀ █▀▒ █▀▒ █▀▒
  17.                  ▄   ▀    ▀ ▄  ▀ ▄▀▄ █ ▓▄▄ ▓▄█ ▓▀▄ ▓▀▀
  18.  
  19.  
  20.              <┤EGiS CoRP TuToRiaL SeRiES
  21.                · ··-────────────--·· ·
  22.                   ChaPTeR 1
  23.             · ··-───────────────────────────--·· ·
  24.  
  25.                DiSPLaYiNG STRiNGS WiTH eFFeCTS
  26.  
  27.                    By LoNE RuNNeR
  28.  
  29.  
  30.  
  31.  
  32.   WARNING
  33.   ──────────────────────────────
  34.  
  35.   WARNING : If you want to learn PPL from scratch, the AEGiS Tutorial series
  36.   are not for you... the tutorial series are intended to sysops that already
  37.   have some basis on PPL programming, it is only here to give you hints and
  38.   ideas or simply to show you some different wayz to do different things...
  39.   However, if you never tried to code somme PPE's but you know how to code
  40.   in basic or pascal, you should have no problem to transfer your skills on
  41.   PPL!
  42.  
  43.   Also, if you think that we don't have anything to learn you, don't read this
  44.   and delete it from your disk... this file is not here to say "Hey man! look,
  45.   this is the way it HAS to be done coz we are the best!"... we just want to
  46.   give some hints to all the sysops that need it or that want to see others
  47.   coding technics.. everybody code diferent... so there is allways something
  48.   to learn from a source code...
  49.  
  50.  
  51.   WHAT ARE THE TUTORIAL SERIES ?
  52.   ──────────────────────────────
  53.  
  54.  
  55.   Why using other group's PPE's when it is so easy to make your own ones...?
  56.  
  57.   This is after asking such a question to sysop (a good friend of mine), and
  58.   after he answered "coz i cannot find the fucking way to do what i want!"
  59.   that i decided to begin the tutorial series...
  60.  
  61.   In thoses tutorials, you will find the basics to begin PPE coding, and i
  62.   hope you will begin to make some good releases and, why not, join the
  63.   Aegis Corp crew ! ;)
  64.  
  65.   
  66.   CHAPTER 1
  67.   ──────────────────────────────
  68.  
  69.   Today we will have a look to the different methods on how to display
  70.   strings with some visual effects...
  71.  
  72.   We have to examples (see AGSTUT1.PPS) :
  73.  
  74.   PrintFade()
  75.   PrintScramble()
  76.  
  77.   The first procedure will write a string with a fading effect...
  78.   The seconf procedure will write a string with a scramble effect...
  79.  
  80.  
  81.   PRINTFADE()
  82.   ──────────────────────────────
  83.  
  84.   With this procedure, we want to add a fading effet to the string beeing
  85.   displayed... for example we can put each character in color 8 (dark grey)
  86.   then change it's color to 7 (grey), and finish with the color 15 (white).
  87.  
  88.   This will make a nice visual effect... i think ;)
  89.  
  90.  
  91.   PRINTSCRAMBLE()
  92.   ──────────────────────────────
  93.  
  94.   With this procedure, we have a precise wish on what have to be the
  95.   effect... the string has to appear in a scramble way, that is in fact that
  96.   each character will be displayed normally but in a random order...
  97.  
  98.   The first way to do it is the flat way : we take randomly a character from
  99.   the string to print, and we put it in the right place... with or without
  100.   trying to verify if it has already be printed... and we stop when the
  101.   screen contains the complete string (comparision with a
  102.   ScrText(row, line, len, code))
  103.  
  104.   This way will work, but if you are unlucky, you may wait for a long time
  105.   before each character has been printed...
  106.  
  107.   So we will forget this way...
  108.  
  109.   The second way is more complex, but a lot more reliable... we take a string
  110.   made of spaces that is as long as the string to print...
  111.  
  112.   so we have for example "             " for "Hello, world!"...
  113.  
  114.   We take a reference that hold the amount of chars to be printed... so it
  115.   begins with the string's length...
  116.  
  117.   ref = 13
  118.  
  119.   Then we generate a random number from 1 to ref... for example, we have 9...
  120.  
  121.   we try to find the 9th space in the string :
  122.  
  123.   "             "
  124.        ^
  125.        9th space
  126.  
  127.   and we replace it with the right character :
  128.  
  129.   "        o    "
  130.        ^
  131.        9th space replaced by "o" from "world"
  132.  
  133.   and we decrement the reference variable...
  134.  
  135.   Then we repeat this as long as the reference variable is not 0...
  136.  
  137.   here is for example the second pass :
  138.  
  139.   randomly generated number (from 1 to ref=12) -> 11
  140.  
  141.   "        o    "
  142.           ^
  143.           11th space (but 12th char!)
  144.   
  145.   we replace it by the right char :
  146.   
  147.   "        o  d "
  148.           ^
  149.           11th space replaced by "d" from "world"
  150.  
  151.   at the end of the loop, we will have less and less spaces left, and it will
  152.   end with a random from 1 to 1...
  153.  
  154.  
  155.   The problem of this algorythm is that it does not handle spaces... if we
  156.   replace the nth space by the corresponding character -> a space, the
  157.   reference var will be decremented but the string will stay the same, and
  158.   the already printed character that is a space will be replaced by another
  159.   char in a futur pass...
  160.  
  161.   The solution consist in replacing spaces by CHR(255) that looks exactly the
  162.   same that spaces, but are different in screen memory...
  163.  
  164.   To optimize the procedure, we won't use a special string made of spaces for
  165.   working... but we will use the screen instead... so it has to contain
  166.   spaces before to begin, or the procedure will go in an endless loop trying
  167.   to find a free char (a space) that does not exist...
  168.  
  169.  
  170.  
  171.   FINAL PROCEDURES
  172.   ──────────────────────────────
  173.  
  174.   To see the final procedures, have a look a AGSTUT1.PPS
  175.  
  176.  
  177.  
  178.   DISCLAIMER
  179.   ──────────────────────────────
  180.  
  181.  
  182.   Do what you want with this, you have the code so you keep control over the
  183.   compilation... you may use this code in whatever you want, you may destroy
  184.   it, burn it, compile it or modify it, you may do what you want, but no
  185.   member of AEGiS CoRP may be responsible for any damage caused by the use
  186.   of this code or it's modifications...
  187.   Also you can use it into your own releases, but please, don't be lame,
  188.   greet us ;)
  189.  
  190.  
  191.  
  192.   FINAL WORDS
  193.   ──────────────────────────────
  194.  
  195.  
  196.   Hope this will help you in customizing your PCB... If you have any comment
  197.   or suggection, or if you just want to chat about PPE's and PPL, or for any
  198.   other reason, don't hesitate to write us to :
  199.  
  200.   aegis.corp_barnabo@sparkhq.fdn.org
  201.   
  202.  
  203.                             - LoNE RuNNeR -
  204.  
  205.  
  206.                      _    _  _ ___ ___/\
  207.     _________/\  /\_____________/\________________ ___ _  _ \/\______________
  208.    /      _    \/   _________  /    ______________________  /   __________  /
  209.  _/     __/     \    ____)___\/     \         \_/         \/\___________  \/_
  210.  \      \        \_  \        \_     \__       \_            \_        /    /
  211.   \______\        /____________/________________/_____________/____________/kP
  212.   ·-------`------'---------------------------------------------------------·
  213.  
  214.  
  215.  
  216.